Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

291
Views
Error de PHP (error interno del servidor 500) al usar $stmt->get_result()->fetch_assoc();

Tengo una función que funciona así.

 public function get_user_by_email($email) { $stmt = $this->con->prepare("SELECT * FROM `user` WHERE `email` = ? "); $stmt->bind_param("s", $email); $stmt->execute(); return $stmt->get_result()->fetch_assoc(); }

El problema es que cada vez que llamo a esta función con cualquier correo electrónico (ya sea que exista en la base de datos o no) arroja el error interno del servidor 500. Estoy usando un servidor de alojamiento en vivo y Postman para probar esto. ¿Alguien puede ayudar?

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Intente depurar con el siguiente código:

 public function get_user_by_email($email) { $stmt = $this->con->prepare("SELECT * FROM `dbname.user` WHERE `email` = ? "); $stmt->bind_param("s", $email); $stmt->execute(); $result = $stmt->get_result(); echo "Result Object: "; echo $result; // If it's OK, it should print "Object ( ... )" $arr = $result->fetch_assoc(); echo "Fetched Object: "; echo $arr; // If it's OK, then it'd print "Array ( ... )" return $arr; }
over 4 years ago · Santiago Trujillo Report

0

También experimenté este error. Viene de get_result() -> https://www.php.net/manual/en/mysqli-stmt.get-result.php

Creé una aplicación usando JS, PHP y MySQL. Todo funcionó bien localmente, pero cuando lo cargué en un servidor compartido, empiezo a recibir un error de servidor interno 500 (el host del servidor podría haber arrojado un error 500 en lugar de mostrar un error fatal en la pantalla). Esto se solucionó cuando deshabilité mysqli y habilité nd_mysqli desde las extensiones PHP de mi hosting.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!